<template>
    <div>
        <!-- 添加 -->
        <el-button type="primary" @click="willAdd">添加</el-button>
        <!-- 列表 -->
        <list-vue :list="list" @willEdit="willEdit" @init="init"></list-vue>
        <!-- 弹窗 -->
        <form-vue :info="info" @init="init" ref="form"></form-vue>
    </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import listVue from "./components/list.vue";
import formVue from "./components/form.vue";
import { reqrolelist } from "../../http/api";
import { toggle } from "../../mixins/mixins"
export default {
    components: {
        listVue,
        formVue
    },
    props: [],
    mixins: [toggle],
    data() {
        return {
            list: [],
            info: {
                isshow: false,
                isAdd: true
            }
        }
    },
    computed: {
        ...mapGetters({}),
    },
    mounted() {
        this.init()
    },
    methods: {
        ...mapActions({}),
        init() {
            reqrolelist().then(res => {
                if (res.data.code == 200) {
                    this.list = res.data.list ? res.data.list : []
                }
            })
        }
    },
};
</script>
<style scoped lang="less">
@import "../../less/index.less";
</style>